{#
  Copyright 2015 Google Inc. All Rights Reserved.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
#}

<div class="dialog" id="add-trace-action">
  <div class="dialog__box">

    <section class="dialog__box-content">

      <form action="{{ action_upload_url }}" method="post" enctype="multipart/form-data">
        <h1 class="dialog__title">Upload file</h1>

        <p class="dialog__description">
          Add a Trace / DevTools Timeline file (.json, .json.gz) to this Action.
          {% if action_label and action_type != 'Load' %}
           <b>Note: only parts of the trace that match {{ action_label }} will be imported</b>
          {% endif %}
        </p>

        <section class="dialog__section">
          <input type="file" name="file" id="trace-file" accept=".json,.gz" />
        </section>

        <div class="dialog__button-container">
          <button type="button" class="cancel-button mdl-button mdl-js-button mdl-js-ripple-effect">
            Cancel
          </button>

          <button type="button" class="confirm-button mdl-button mdl-js-button mdl-js-ripple-effect">
            Upload File
          </button>
        </div>

        {% if action_label %}
        <input type="hidden" id="action-label" name="action-label" value="{{ action_label }}">
        {% endif %}

        <input type="hidden" id="project-secret" name="project-secret" value="{{ project_secret }}">

      </form>
    </section>

    <section class="dialog__spinner-container">
      <div class="dialog__spinner mdl-spinner mdl-js-spinner is-active"></div>
    </section>

    <section class="dialog__complete-content">
      <div class="dialog__complete-message">
        <i class="material-icons">cloud_done</i>
        <h1 class="dialog__complete-title">Upload complete</h1>
        <p class="dialog__complete-message">
          <strong>Please note:</strong> results may not show immediately; processing may take a few minutes.</p>
      </div>
    </section>
  </div>
</div>

<button id="add-trace-button" class="add-trace mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored">
  <i class="material-icons">file_upload</i>
</button>
